/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ortustve.media.metadata;

import ortustve.Ortus;

/**
 *
 * @author jphipps
 */
public class MetadataFactory {

    private static MetadataFactory INSTANCE;
    public IMetadataProvider MDProvider;

    private enum METADATA { DB , WIZ };

    public static MetadataFactory getInstance() {
        if ( INSTANCE == null) {
            if ( Ortus.getInstance().modules.get("db") != null ) {
                INSTANCE = new MetadataFactory(METADATA.DB);
            } else {
                INSTANCE = new MetadataFactory(METADATA.WIZ);
            }
        }
        return INSTANCE;
    }

    public static MetadataFactory reloadInstance() {
	    INSTANCE=null;
	    return getInstance();
    }
    
    private MetadataFactory(METADATA mETADATA) {
        if ( mETADATA == METADATA.DB)
            MDProvider = new ortustve.media.metadata.DBMetadata();
        else
            MDProvider = new ortustve.media.metadata.WIZMetadata();

    }

    public IMetadataProvider getProvider() {
        return MDProvider;
    }

}
